# (C) Datadog, Inc. 2022-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os

from datadog_checks.dev import get_docker_hostname, get_here

HERE = get_here()
HOST = get_docker_hostname()
PORT = '8080'
METRICS_URL = f'http://{HOST}:{PORT}/metrics'

PULSAR_VERSION = os.getenv('PULSAR_VERSION')

EXPECTED_METRICS = [
    'pulsar.active_connections',
    'pulsar.broker_lookup.count',
    'pulsar.broker_lookup.sum',
    'pulsar.broker_lookup_answers.count',
    'pulsar.broker_lookup_failures.count',
    'pulsar.broker_lookup_pending_requests',
    'pulsar.broker_lookup_redirects.count',
    'pulsar.broker_throttled_connections',
    'pulsar.broker_throttled_connections_global_limit',
    'pulsar.broker_topic_load_pending_requests',
    'pulsar.connection_closed_total_count',
    'pulsar.connection_create_fail_count',
    'pulsar.connection_create_success_count',
    'pulsar.connection_created_total_count',
    'pulsar.consumer_available_permits',
    'pulsar.consumer_blocked_on_unacked_messages',
    'pulsar.consumer_msg_rate_out',
    'pulsar.consumer_msg_rate_redeliver',
    'pulsar.consumer_msg_throughput_out',
    'pulsar.consumer_unacked_messages',
    'pulsar.consumers_count',
    'pulsar.in_bytes_total',
    'pulsar.in_messages_total',
    'pulsar.jetty_async_requests_waiting',
    'pulsar.jetty_async_requests_waiting_max',
    'pulsar.jetty_dispatched_active',
    'pulsar.jetty_dispatched_active_max',
    'pulsar.jetty_dispatched_time_max',
    'pulsar.jetty_request_time_max_seconds',
    'pulsar.jetty_requests_active',
    'pulsar.jetty_requests_active_max',
    'pulsar.jetty_stats_seconds',
    'pulsar.ml_AddEntryBytesRate',
    'pulsar.ml_AddEntryErrors',
    'pulsar.ml_AddEntryMessagesRate',
    'pulsar.ml_AddEntrySucceed',
    'pulsar.ml_AddEntryWithReplicasBytesRate',
    'pulsar.ml_MarkDeleteRate',
    'pulsar.ml_NumberOfMessagesInBacklog',
    'pulsar.ml_ReadEntriesBytesRate',
    'pulsar.ml_ReadEntriesErrors',
    'pulsar.ml_ReadEntriesRate',
    'pulsar.ml_ReadEntriesSucceeded',
    'pulsar.ml_StoredMessagesSize',
    'pulsar.ml_cache_evictions',
    'pulsar.ml_cache_hits_rate',
    'pulsar.ml_cache_hits_throughput',
    'pulsar.ml_cache_misses_rate',
    'pulsar.ml_cache_misses_throughput',
    'pulsar.ml_cache_pool_active_allocations',
    'pulsar.ml_cache_pool_active_allocations_huge',
    'pulsar.ml_cache_pool_active_allocations_normal',
    'pulsar.ml_cache_pool_active_allocations_small',
    'pulsar.ml_cache_pool_allocated',
    'pulsar.ml_cache_pool_used',
    'pulsar.ml_cache_used_size',
    'pulsar.ml_count',
    'pulsar.out_bytes_total',
    'pulsar.out_messages_total',
    'pulsar.producers_count',
    'pulsar.rate_in',
    'pulsar.rate_out',
    'pulsar.storage_backlog_quota_limit',
    'pulsar.storage_backlog_size',
    'pulsar.storage_logical_size',
    'pulsar.storage_offloaded_size',
    'pulsar.storage_read_rate',
    'pulsar.storage_size',
    'pulsar.storage_write_rate',
    'pulsar.subscription_back_log',
    'pulsar.subscription_blocked_on_unacked_messages',
    'pulsar.subscription_delayed',
    'pulsar.subscription_msg_rate_out',
    'pulsar.subscription_msg_rate_redeliver',
    'pulsar.subscription_msg_throughput_out',
    'pulsar.subscription_unacked_messages',
    'pulsar.subscriptions_count',
    'pulsar.throughput_in',
    'pulsar.throughput_out',
    'pulsar.topics_count',
]
OPTIONAL_METRICS = ['pulsar.broker_lookup.quantile']
